package com.cxs.serviceabilitydemo;

import com.cxs.serviceabilitydemo.connections.MyRemote;
import com.cxs.serviceabilitydemo.util.UIUtils;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.rpc.IRemoteObject;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
// 等待连接侧的PA
public class RemoteServiceAbility extends Ability {
    private static final HiLogLabel LABEL_LOG = new HiLogLabel(3, 0xD001100, "Demo");
    // 等待连接侧
    private MyRemote remote = new MyRemote();

    @Override
    public void onStart(Intent intent) {
        System.out.println("RemoteServiceAbility::onStart");
        super.onStart(intent);
        UIUtils.showTip(this,"onStart");
    }

    @Override
    public void onBackground() {
        super.onBackground();
    }

    @Override
    public void onStop() {
        super.onStop();
        System.out.println("RemoteServiceAbility::onStop");
        UIUtils.showTip(this,"onStop");
    }

    @Override
    public void onCommand(Intent intent, boolean restart, int startId) {
        System.out.println("RemoteServiceAbility::onCommand");
        UIUtils.showTip(this,"onCommand");
    }

    @Override
    public IRemoteObject onConnect(Intent intent) {
        return remote;
    }

    @Override
    public void onDisconnect(Intent intent) {
        UIUtils.showTip(this,"断开连接");
    }
}